package com.sunb2b.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class B2B {
	private static Properties prop;
	static{
		try {
			InputStream stream = B2B.class.getResourceAsStream("/config.properties");
			if(stream==null){
				System.out.println("Can't locate configuration file from classpath.");
				throw new Error("Can't find system configuration file config.properties.");
			}
			prop = new Properties();
			prop.load(stream);
			System.out.println("system configuration file was loaded successfully.");
		} catch (IOException e) {
			prop = null;
			e.printStackTrace();
			throw new Error("Can't find system configuration file config.properties.");
		} 
	}
	
	public static String get(String key){
		return prop.getProperty(key);
	}
	
	public static void main(String[] args){
		System.out.println(get("lucene.index.dir"));
	}
}
